<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

class TaskLog extends Model
{
	use HasDateTimeFormatter;
    use SoftDeletes;

    protected $table = 'task_log';
    protected $fillable = [
        'user_id',
        'task_id',
        'amount',
        'created_at',
    ];
    public static function add($user_id, $task_id, $amount)
    {
        return self::create([
            'user_id' => $user_id,
            'task_id' => $task_id,
            'amount' => $amount,
            'created_at' => now()->toDateTimeString(),
        ]);
    }
}
